package com.kzc.dao;


import com.kzc.core.MyBatisDao;
import com.kzc.dao.provider.StudentProvider;
import com.kzc.entity.Student;
import com.kzc.vo.StudentVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 数据库操作
 * Author：柯尊诚
 * Created by anyleKe on 2016/1/29.
 */
@MyBatisDao
public interface StudentDao {

    @Options(useGeneratedKeys=true, keyProperty="id")
    @Insert("insert into t_student(name,type,card_id) values(#{name},#{type},#{card_id})")
    int save(Student student);

    @Delete("delete from t_student where id = #{id}")
    int delete(int id);

    @Update("update t_student set name = #{name}, type = #{type}, card_id = #{card_id} where id = #{id}")
    int update(Student student);

    @Select("select * from t_student")
    List<Student> query();

    @SelectProvider(type = StudentProvider.class, method = "getQuerySql")
    List<Student> queryPage(StudentVO vo);

    @SelectProvider(type = StudentProvider.class, method = "getCountSql")
    int count(StudentVO vo);
}
